home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / rpcstat / RCS / rpcstat.c,v < prev    next >
Text File  |  1992-07-10  |  60KB  |  2,649 lines

  1. head     1.23;
  2. branch   ;
  3. access   ;
  4. symbols  sprited:1.21.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.23
  10. date     92.07.10.15.16.17;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.22;
  13.  
  14. 1.22
  15. date     91.04.01.14.19.36;  author kupfer;  state Exp;
  16. branches ;
  17. next     1.21;
  18.  
  19. 1.21
  20. date     90.12.06.10.40.37;  author mendel;  state Exp;
  21. branches 1.21.1.1;
  22. next     1.20;
  23.  
  24. 1.20
  25. date     90.11.29.22.21.22;  author kupfer;  state Exp;
  26. branches ;
  27. next     1.19;
  28.  
  29. 1.19
  30. date     90.11.20.17.19.55;  author mgbaker;  state Exp;
  31. branches 1.19.1.1;
  32. next     1.18;
  33.  
  34. 1.18
  35. date     90.07.03.17.12.17;  author mgbaker;  state Exp;
  36. branches ;
  37. next     1.17;
  38.  
  39. 1.17
  40. date     89.07.01.12.17.05;  author brent;  state Exp;
  41. branches ;
  42. next     1.16;
  43.  
  44. 1.16
  45. date     89.06.23.13.41.16;  author brent;  state Exp;
  46. branches ;
  47. next     1.15;
  48.  
  49. 1.15
  50. date     89.06.23.13.19.31;  author brent;  state Exp;
  51. branches ;
  52. next     1.14;
  53.  
  54. 1.14
  55. date     89.06.16.08.48.31;  author brent;  state Exp;
  56. branches ;
  57. next     1.13;
  58.  
  59. 1.13
  60. date     89.05.15.17.50.30;  author mendel;  state Exp;
  61. branches ;
  62. next     1.12;
  63.  
  64. 1.12
  65. date     88.12.22.11.06.53;  author douglis;  state Exp;
  66. branches ;
  67. next     1.11;
  68.  
  69. 1.11
  70. date     88.11.23.08.54.27;  author ouster;  state Exp;
  71. branches ;
  72. next     1.10;
  73.  
  74. 1.10
  75. date     88.10.31.14.45.08;  author brent;  state Exp;
  76. branches ;
  77. next     1.9;
  78.  
  79. 1.9
  80. date     88.10.31.13.40.21;  author mendel;  state Exp;
  81. branches ;
  82. next     1.8;
  83.  
  84. 1.8
  85. date     88.10.03.12.05.15;  author brent;  state Exp;
  86. branches ;
  87. next     1.7;
  88.  
  89. 1.7
  90. date     87.10.06.09.31.45;  author brent;  state Exp;
  91. branches ;
  92. next     1.6;
  93.  
  94. 1.6
  95. date     87.09.29.21.55.21;  author brent;  state Exp;
  96. branches ;
  97. next     1.5;
  98.  
  99. 1.5
  100. date     87.09.10.17.26.45;  author brent;  state Exp;
  101. branches ;
  102. next     1.4;
  103.  
  104. 1.4
  105. date     87.05.28.11.28.31;  author nelson;  state Exp;
  106. branches ;
  107. next     1.3;
  108.  
  109. 1.3
  110. date     87.05.01.15.59.55;  author brent;  state Exp;
  111. branches ;
  112. next     1.2;
  113.  
  114. 1.2
  115. date     86.11.19.14.53.05;  author douglis;  state Exp;
  116. branches ;
  117. next     1.1;
  118.  
  119. 1.1
  120. date     86.11.08.00.07.09;  author douglis;  state Exp;
  121. branches ;
  122. next     ;
  123.  
  124. 1.19.1.1
  125. date     90.11.29.21.53.55;  author kupfer;  state Exp;
  126. branches ;
  127. next     ;
  128.  
  129. 1.21.1.1
  130. date     92.07.10.15.42.34;  author kupfer;  state Exp;
  131. branches ;
  132. next     ;
  133.  
  134.  
  135. desc
  136. @General statistics routines, especially for rpc.
  137. @
  138.  
  139.  
  140. 1.23
  141. log
  142. @Add -chist and -shist options.  Lint.
  143. @
  144. text
  145. @/* 
  146.  * rpcStat.c --
  147.  *
  148.  *    Statistics generation, especially for the rpc module.
  149.  *
  150.  * Copyright (C) 1986 Regents of the University of California
  151.  * All rights reserved.
  152.  */
  153.  
  154. #ifndef lint
  155. static char rcsid[] = "$Header: /sprite/src/cmds/rpcstat/RCS/rpcstat.c,v 1.22 91/04/01 14:19:36 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)";
  156. #endif not lint
  157.  
  158. #include <sprite.h>
  159. #include <stdio.h>
  160. #include <stdlib.h>
  161. #include <sysStats.h>
  162. #include <option.h>
  163. #include <kernel/sched.h>
  164. #include <vmStat.h>
  165. #include <host.h>
  166. #include <kernel/sync.h>
  167. #include <kernel/timer.h>
  168. #include <kernel/rpcClient.h>
  169. #include <kernel/rpcServer.h>
  170. #include <kernel/rpcCltStat.h>
  171. #include <kernel/rpcSrvStat.h>
  172. #include <kernel/rpcTrace.h>
  173. #include <kernel/rpcCall.h>
  174. #include <kernel/rpcHistogram.h>
  175.  
  176. Boolean doCltStats = FALSE;
  177. Boolean doSrvStats = FALSE;
  178. Boolean doCltState = FALSE;
  179. Boolean doSrvState = FALSE;
  180. Boolean doRpcTrace = FALSE;
  181. Boolean doCallCount = FALSE;
  182. Boolean doSrvCount = FALSE;
  183. Boolean doCltHist = FALSE;
  184. Boolean doSrvHist = FALSE;
  185. Boolean zero     = FALSE;
  186. int extraSpace = 1000;
  187. Boolean    nohostdb = FALSE;
  188.  
  189. Option optionArray[] = {
  190.     {OPT_TRUE, "trace", (Address)&doRpcTrace, "Print trace of RPCs"},
  191.     {OPT_TRUE, "cinfo", (Address)&doCltStats, "Print client RPC statistics"},
  192.     {OPT_TRUE, "sinfo", (Address)&doSrvStats, "Print server RPC statistics"},
  193.     {OPT_TRUE, "chan", (Address)&doCltState, "Print client channel state"},
  194.     {OPT_TRUE, "srvr", (Address)&doSrvState, "Print server process state"},
  195.     {OPT_TRUE, "calls", (Address)&doCallCount, "Print number of client calls"},
  196.     {OPT_TRUE, "rpcs", (Address)&doSrvCount, "Print number of service calls"},
  197.     {OPT_TRUE, "chist", (Address)&doCltHist,
  198.      "Print histogram of (client) call times"},
  199.     {OPT_TRUE, "shist", (Address)&doSrvHist,
  200.      "Print histogram of service times"},
  201.     {OPT_TRUE, "zero", (Address)&zero, "Print zero valued stats"},
  202.     {OPT_INT, "x", (Address)&extraSpace, "Extra malloc space to avoid crashes"},
  203.     {OPT_TRUE, "nohostdb", (Address)&nohostdb, "Do not search the host database"},
  204. };
  205. int numOptions = sizeof(optionArray) / sizeof(Option);
  206.  
  207. ReturnStatus status;
  208.  
  209. /* forward references: */
  210.  
  211. static void PrintCltHist();
  212. static void PrintSrvHist();
  213. static void PrintHist();
  214.  
  215.  
  216. /*
  217.  *----------------------------------------------------------------------
  218.  *
  219.  * main --
  220.  *
  221.  *    Gets options and calls printing routines.
  222.  *
  223.  * Results:
  224.  *    None.
  225.  *
  226.  * Side effects:
  227.  *    None.
  228.  *
  229.  *----------------------------------------------------------------------
  230.  */
  231.  
  232. main(argc, argv)
  233.     int argc;
  234.     char *argv[];
  235. {
  236.  
  237.     argc = Opt_Parse(argc, argv,  optionArray, numOptions, 0);
  238.  
  239.     if (doCltStats) {
  240.     PrintClientStats();
  241.     }
  242.     if (doSrvStats) {
  243.     PrintServerStats();
  244.     }
  245.     if (doCltState) {
  246.     PrintClientState();
  247.     }
  248.     if (doSrvState) {
  249.     PrintServerState();
  250.     }
  251.     if (doCallCount) {
  252.     PrintCallCount();
  253.     }
  254.     if (doSrvCount) {
  255.     PrintSrvCount();
  256.     }
  257.     if (doCltHist) {
  258.     PrintCltHist();
  259.     }
  260.     if (doSrvHist) {
  261.     PrintSrvHist();
  262.     }
  263.     if (doRpcTrace) {
  264.     PrintRpcTrace(argc, argv);
  265.     }
  266.     exit(0);
  267. }
  268.  
  269. /*
  270.  *----------------------------------------------------------------------
  271.  *
  272.  * PrintClientStats --
  273.  *
  274.  *    Prints out the low-level statistics for the client side
  275.  *    of the RPC system.
  276.  *
  277.  * Results:
  278.  *    None.
  279.  *
  280.  * Side effects:
  281.  *    None.
  282.  *
  283.  *----------------------------------------------------------------------
  284.  */
  285.  
  286. PrintClientStats()
  287. {
  288.     Rpc_CltStat rpcCltStat;
  289.  
  290.     status = Sys_Stats(SYS_RPC_CLT_STATS, TRUE, &rpcCltStat);
  291.     if (status != SUCCESS) {
  292.     return;
  293.     }
  294.     printf("Rpc Client Statistics\n");
  295.     printf("toClient   = %5d ", rpcCltStat.toClient);
  296.     printf("badChannel  = %4d ", rpcCltStat.badChannel);
  297.     printf("chanBusy    = %4d ", rpcCltStat.chanBusy);
  298.     printf("badId       = %4d ", rpcCltStat.badId);
  299.     printf("\n");
  300.     printf("requests   = %5d ", rpcCltStat.requests);
  301.     printf("replies    = %5d ", rpcCltStat.replies);
  302.     printf("acks        = %4d ", rpcCltStat.acks);
  303.     printf("recvPartial = %4d ", rpcCltStat.recvPartial);
  304.     printf("\n");
  305.     printf("nacks       = %4d ", rpcCltStat.nacks);
  306.     printf("reNacks     = %4d ", rpcCltStat.reNacks);
  307.     printf("maxNacks    = %4d ", rpcCltStat.maxNacks);
  308.     printf("timeouts    = %4d ", rpcCltStat.timeouts);
  309.     printf("\n");
  310.     printf("aborts      = %4d ", rpcCltStat.aborts);
  311.     printf("resends     = %4d ", rpcCltStat.resends);
  312.     printf("sentPartial = %4d ", rpcCltStat.sentPartial);
  313.     printf("errors      = %d(%d)", rpcCltStat.errors,
  314.                        rpcCltStat.nullErrors);
  315.     printf("\n");
  316.     printf("dupFrag     = %4d ", rpcCltStat.dupFrag);
  317.     printf("close       = %4d ", rpcCltStat.close);
  318.     printf("oldInputs   = %4d ", rpcCltStat.oldInputs);
  319.     printf("badInputs   = %4d ", rpcCltStat.oldInputs);
  320.     printf("\n");
  321.     printf("tooManyAcks = %4d ", rpcCltStat.tooManyAcks);
  322.     printf("chanHits   = %5d ", rpcCltStat.chanHits);
  323.     printf("chanNew     = %4d ", rpcCltStat.chanNew);
  324.     printf("chanReuse   = %4d ", rpcCltStat.chanReuse);
  325.     printf("\n");
  326.     printf("newTrouble  = %4d ", rpcCltStat.newTrouble);
  327.     printf("moreTrouble = %4d ", rpcCltStat.moreTrouble);
  328.     printf("endTrouble  = %4d ", rpcCltStat.endTrouble);
  329.     printf("noMark      = %4d ", rpcCltStat.noMark);
  330.     printf("\n");
  331.     printf("nackChanWait= %4d ", rpcCltStat.nackChanWait);
  332.     printf("chanWaits   = %4d ", rpcCltStat.chanWaits);
  333.     printf("chanBroads  = %4d ", rpcCltStat.chanBroads);
  334.     printf("paramOverrun = %3d ", rpcCltStat.paramOverrun);
  335.     printf("\n");
  336.     printf("dataOverrun = %4d ", rpcCltStat.dataOverrun);
  337.     printf("shorts      = %4d ", rpcCltStat.shorts);
  338.     printf("longs       = %4d ", rpcCltStat.longs);
  339.     printf("\n");
  340. }
  341.  
  342. /*
  343.  *----------------------------------------------------------------------
  344.  *
  345.  * PrintServerStats --
  346.  *
  347.  *    Prints out the low-level statistics for the service side
  348.  *    of the RPC system.
  349.  *
  350.  * Results:
  351.  *    None.
  352.  *
  353.  * Side effects:
  354.  *    None.
  355.  *
  356.  *----------------------------------------------------------------------
  357.  */
  358.  
  359. PrintServerStats()
  360. {
  361.     Rpc_SrvStat rpcSrvStat;
  362.  
  363.     status = Sys_Stats(SYS_RPC_SRV_STATS, TRUE, &rpcSrvStat);
  364.     if (status != SUCCESS) {
  365.     return;
  366.     }
  367.     printf("Rpc Server Statistics\n");
  368.     printf("toServer   = %5d ", rpcSrvStat.toServer);
  369.     printf("noAlloc     = %4d ", rpcSrvStat.noAlloc);
  370.     printf("invClient   = %4d ", rpcSrvStat.invClient);
  371.     printf("\n");
  372.     printf("nacks       = %4d ", rpcSrvStat.nacks);
  373.     printf("mostNackBufs= %4d ", rpcSrvStat.mostNackBuffers);
  374.     printf("selfNacks   = %4d ", rpcSrvStat.selfNacks);
  375.     printf("\n");
  376.     printf("serverBusy  = %4d ", rpcSrvStat.serverBusy);
  377.     printf("requests   = %5d ", rpcSrvStat.requests);
  378.     printf("impAcks    = %5d ", rpcSrvStat.impAcks);
  379.     printf("handoffs   = %5d ", rpcSrvStat.handoffs);
  380.     printf("\n");
  381.     printf("fragMsgs   = %5d ", rpcSrvStat.fragMsgs);
  382.     printf("handoffAcks = %4d ", rpcSrvStat.handoffAcks);
  383.     printf("fragAcks    = %4d ", rpcSrvStat.fragAcks);
  384.     printf("sentPartial = %4d ", rpcSrvStat.recvPartial);
  385.     printf("\n");
  386.     printf("busyAcks    = %4d ", rpcSrvStat.busyAcks);
  387.     printf("resends     = %4d ", rpcSrvStat.resends);
  388.     printf("badState    = %4d ", rpcSrvStat.badState);
  389.     printf("extra       = %4d ", rpcSrvStat.extra);
  390.     printf("\n");
  391.     printf("reclaims    = %4d ", rpcSrvStat.reclaims);
  392.     printf("reassembly = %5d ", rpcSrvStat.reassembly);
  393.     printf("dupFrag     = %4d ", rpcSrvStat.dupFrag);
  394.     printf("nonFrag     = %4d ", rpcSrvStat.nonFrag);
  395.     printf("\n");
  396.     printf("fragAborts  = %4d ", rpcSrvStat.fragAborts);
  397.     printf("recvPartial = %4d ", rpcSrvStat.recvPartial);
  398.     printf("closeAcks   = %4d ", rpcSrvStat.closeAcks);
  399.     printf("discards    = %4d ", rpcSrvStat.discards);
  400.     printf("\n");
  401.     printf("unknownAcks = %4d ", rpcSrvStat.unknownAcks);
  402.     printf("\n");
  403. }
  404.  
  405. /*
  406.  *----------------------------------------------------------------------
  407.  *
  408.  * PrintClientState --
  409.  *
  410.  *    Prints out the state of each client-side channel.
  411.  *
  412.  * Results:
  413.  *    None.
  414.  *
  415.  * Side effects:
  416.  *    None.
  417.  *
  418.  *----------------------------------------------------------------------
  419.  */
  420.  
  421. PrintClientState()
  422. {
  423.     register int index;
  424.     ReturnStatus status = SUCCESS;
  425.     RpcClientChannel *chanPtr =
  426.     (RpcClientChannel *)malloc(sizeof(RpcClientChannel) + extraSpace);
  427.  
  428.     printf("%2s  %-10s  %-15s %-8s %s\n",
  429.         "I", "RPC", "Server", "Channel", "State");
  430.     for (index=0 ; status == SUCCESS ; index++) {
  431.     status = Sys_Stats(SYS_RPC_CLT_STATE, index, (Address)chanPtr);
  432.     if (status != SUCCESS) {
  433.         break;
  434.     }
  435.     printf("%2d ", index);
  436.     PrintCommand(stdout, chanPtr->requestRpcHdr.command, " %-10s ");
  437.     PrintHostName(chanPtr->serverID, " %-15s ");
  438.     printf("%-8d ", chanPtr->requestRpcHdr.channel);
  439.     if (chanPtr->state == CHAN_FREE) {
  440.         printf("free ");
  441.     }
  442.     if (chanPtr->state & CHAN_BUSY) {
  443.         printf("busy ");
  444.     }
  445.     if (chanPtr->state & CHAN_WAITING) {
  446.         printf("wait ");
  447.     }
  448.     if (chanPtr->state & CHAN_INPUT) {
  449.         printf("input ");
  450.     }
  451.     if (chanPtr->state & CHAN_TIMEOUT) {
  452.         printf("timeout ");
  453.     }
  454.     printf("\n");
  455.     }
  456. }
  457.  
  458. /*
  459.  *----------------------------------------------------------------------
  460.  *
  461.  * PrintServerState --
  462.  *
  463.  *    Prints out state of each RPC server process.
  464.  *
  465.  * Results:
  466.  *    None.
  467.  *
  468.  * Side effects:
  469.  *    None.
  470.  *
  471.  *----------------------------------------------------------------------
  472.  */
  473.  
  474. PrintServerState()
  475. {
  476.     register int index;
  477.     ReturnStatus status = SUCCESS;
  478.     RpcServerState *srvPtr =
  479.     (RpcServerState *)malloc(sizeof(RpcServerState) + extraSpace);
  480.  
  481.     printf("%2s  %-10s  %-15s %-8s %s\n",
  482.         "I", "RPC", "Client", "Channel", "State");
  483.     for (index=0 ; status == SUCCESS ; index++) {
  484.     status = Sys_Stats(SYS_RPC_SRV_STATE, index, (Address)srvPtr);
  485.     if (status != SUCCESS) {
  486.         break;
  487.     }
  488.     printf("%2d ", index);
  489.     PrintCommand(stdout, srvPtr->requestRpcHdr.command, " %-10s ");
  490.     PrintHostName(srvPtr->clientID, " %-15s ");
  491.     printf("%-8d ", srvPtr->channel);
  492.     if (srvPtr->state == SRV_NOTREADY) {
  493.         printf("not ready");
  494.     }
  495.     if (srvPtr->state & SRV_FREE) {
  496.         printf("free ");
  497.     }
  498.     if (srvPtr->state & SRV_STUCK) {
  499.         printf("stuck ");
  500.     }
  501.     if (srvPtr->state & SRV_BUSY) {
  502.         printf("busy ");
  503.     }
  504.     if (srvPtr->state & SRV_WAITING) {
  505.         printf("wait ");
  506.     }
  507.     if (srvPtr->state & SRV_AGING) {
  508.         printf("aging (%d) ", srvPtr->age);
  509.     }
  510.     if (srvPtr->state & SRV_NO_REPLY) {
  511.         printf("no reply ");
  512.     }
  513.     if (srvPtr->state & SRV_FRAGMENT) {
  514.         printf("frag ");
  515.     }
  516.     printf("\n");
  517.     }
  518. }
  519.  
  520. /*
  521.  *----------------------------------------------------------------------
  522.  *
  523.  * PrintSrvCount --
  524.  *
  525.  *    Prints out the number of RPC calls made to this (server) host
  526.  *
  527.  * Results:
  528.  *    None.
  529.  *
  530.  * Side effects:
  531.  *    None.
  532.  *
  533.  *----------------------------------------------------------------------
  534.  */
  535.  
  536. PrintSrvCount()
  537. {
  538.     ReturnStatus status = SUCCESS;
  539.     register int call;
  540.     int rpcServiceCount[RPC_LAST_COMMAND+1];
  541.  
  542.     status = Sys_Stats(SYS_RPC_SRV_COUNTS, sizeof(rpcServiceCount),
  543.                     (Address)rpcServiceCount);
  544.     if (status != SUCCESS) {
  545.     fprintf(stderr, "Sys_Stats(SYS_RPC_SRV_COUNTS) failed <%x>\n", status);
  546.     return;
  547.     }
  548.  
  549.     printf("Rpc Service Calls\n");
  550.     for (call=0 ; call<=RPC_LAST_COMMAND ; call++) {
  551.     if (zero || rpcServiceCount[call] > 0) {
  552.         PrintCommand(stdout, call, "%-15s");
  553.         printf("%8d\n", rpcServiceCount[call]);
  554.     }
  555.     }
  556. }
  557.  
  558.  
  559. /*
  560.  *----------------------------------------------------------------------
  561.  *
  562.  * PrintCallCount --
  563.  *
  564.  *    Prints out the number of RPC calls made by this (client) host
  565.  *
  566.  * Results:
  567.  *    None.
  568.  *
  569.  * Side effects:
  570.  *    None.
  571.  *
  572.  *----------------------------------------------------------------------
  573.  */
  574.  
  575. PrintCallCount()
  576. {
  577.     ReturnStatus status = SUCCESS;
  578.     register int call;
  579.     int rpcClientCalls[RPC_LAST_COMMAND+1];
  580.  
  581.     status = Sys_Stats(SYS_RPC_CALL_COUNTS, sizeof(rpcClientCalls),
  582.                     (Address)rpcClientCalls);
  583.     if (status != SUCCESS) {
  584.     fprintf(stderr, "Sys_Stats(SYS_RPC_CALL_COUNTS) failed <%x>\n", status);
  585.     return;
  586.     }
  587.  
  588.     printf("Rpc Client Calls\n");
  589.     for (call=0 ; call<=RPC_LAST_COMMAND ; call++) {
  590.     if (zero || rpcClientCalls[call] > 0) {
  591.         PrintCommand(stdout, call, "%-15s");
  592.         printf("%8d\n", rpcClientCalls[call]);
  593.     }
  594.     }
  595. }
  596.  
  597. /*
  598.  *----------------------------------------------------------------------
  599.  *
  600.  * PrintHostName --
  601.  *
  602.  *    Prints out the host name and trims of the internet domain suffix.
  603.  *
  604.  * Results:
  605.  *    None.
  606.  *
  607.  * Side effects:
  608.  *    None.
  609.  *
  610.  *----------------------------------------------------------------------
  611.  */
  612.  
  613. PrintHostName(spriteID, format)
  614.     int spriteID;
  615.     char *format;
  616. {
  617.     Host_Entry *entryPtr;
  618.     char string[64];
  619.     char *cPtr;
  620.  
  621.     if (nohostdb) {
  622.     /*
  623.      * Don't search the /etc/spritehosts host database.  This option
  624.      * is useful for finding consist RPCs that are hung with 
  625.      * /etc/spritehosts locked.  
  626.      */
  627.     entryPtr = (Host_Entry *)NULL;
  628.     } else {
  629.     entryPtr = Host_ByID(spriteID);
  630.     }
  631.     if (entryPtr == (Host_Entry *)NULL) {
  632.     sprintf(string, "%d", spriteID);
  633.     printf(format, string);
  634.     } else {
  635.     for (cPtr = entryPtr->name ; *cPtr ; cPtr++) {
  636.         /*
  637.          * Strip off the domain suffix.
  638.          */
  639.         if (*cPtr == '.') {
  640.         *cPtr = '\0';
  641.         break;
  642.         }
  643.     }
  644.     printf(format, entryPtr->name);
  645.     }
  646. }
  647.  
  648. /*
  649.  *----------------------------------------------------------------------
  650.  *
  651.  * PrintRpcTrace --
  652.  *
  653.  *    Dump out the RPC trace.  Its a circular buffer and we'll print
  654.  *    out time delta's for each record.
  655.  *
  656.  * Results:
  657.  *    None.
  658.  *
  659.  * Side effects:
  660.  *    None.
  661.  *
  662.  *----------------------------------------------------------------------
  663.  */
  664. PrintRpcTrace(argc, argv)
  665.     int argc;
  666.     char *argv[];
  667. {
  668.     register int index;        /* index of current table entry */
  669.     Time baseTime, deltaTime;    /* Times for print out */
  670.     FILE *output;        /* Output stream */
  671.     register RpcHdr *rpcHdrPtr;    /* Rpc header stored in trace record */
  672.     Address buffer;        /* Storage for trace records */
  673.     int  bufSize;
  674.     Trace_Record *recordPtr;
  675.     int numRecords;
  676.  
  677.     if (argc > 1) {
  678.     if (strcmp("on", argv[1]) == 0) {
  679.         status = Sys_Stats(SYS_RPC_TRACE_STATS, SYS_RPC_TRACING_ON, 0);
  680.         return;
  681.     } else if (strcmp("off", argv[1]) == 0) {
  682.         status = Sys_Stats(SYS_RPC_TRACE_STATS, SYS_RPC_TRACING_OFF, 0);
  683.         return;
  684.     } else {
  685.         /*
  686.          * argv[1] is a filename - as an argument causes
  687.          * the trace dump to be written to that file.
  688.          */
  689.         output = fopen(argv[1], "w");
  690.         if (output == (FILE *)NULL) {
  691.         status = FAILURE;
  692.         return;
  693.         }
  694.     }
  695.     } else {
  696.     output = stdout;
  697.     }
  698.     /*
  699.      * Get a copy of the trace table.
  700.      */
  701.     bufSize = sizeof(int) +
  702.         RPC_TRACE_LEN * (sizeof(Trace_Record) + sizeof(RpcHdr));
  703.     buffer = (Address)malloc(bufSize);
  704.     status = Sys_Stats(SYS_RPC_TRACE_STATS, bufSize, buffer);
  705.     if (status != SUCCESS) {
  706.     return;
  707.     }
  708.  
  709.     fprintf(output, "\n");
  710. #define PRINT_HEADER() \
  711.     fprintf(output, \
  712.         "%8s %5s %8s %4s %6s %6s %6s %5s %5s %5s %8s\n", \
  713.     "ID", "code", "time", "flag", "commnd", "client", \
  714.     "server", "psize", "dsize", "doff", "fragment")
  715.     PRINT_HEADER();
  716.  
  717.     numRecords = *(int *)buffer;
  718.     buffer += sizeof(int);
  719.     recordPtr = (Trace_Record *)buffer;
  720.     rpcHdrPtr = (RpcHdr *)((int)buffer + numRecords * sizeof(Trace_Record));
  721.  
  722.     baseTime.seconds = 0;
  723.     baseTime.microseconds = 0;
  724.     for (index=0 ; index<numRecords ; index++, rpcHdrPtr++, recordPtr++) {
  725.     fprintf(output, "%8x", rpcHdrPtr->ID);
  726.     PrintType(output, recordPtr->event, " %-5s");
  727.  
  728.     Time_Subtract(recordPtr->time, baseTime, &deltaTime);
  729.     fprintf(output, " %3d.%04d",
  730.                deltaTime.seconds,
  731.                deltaTime.microseconds / 100);
  732.     baseTime = recordPtr->time;
  733.     PrintFlags(output, rpcHdrPtr->flags, " %-2s");
  734.     if (rpcHdrPtr->flags & RPC_ERROR) {
  735.         fprintf(output, " %8x", rpcHdrPtr->command);
  736.     } else {
  737.         PrintCommand(output, rpcHdrPtr->command, " %-10s");
  738.     }
  739.     fprintf(output, " %4d %d %4d %d",
  740.                rpcHdrPtr->clientID,
  741.                rpcHdrPtr->channel,
  742.                rpcHdrPtr->serverID,
  743.                rpcHdrPtr->serverHint);
  744.     fprintf(output, " %5d %5d %5d %2d %5x",
  745.                rpcHdrPtr->paramSize,
  746.                rpcHdrPtr->dataSize,
  747.                rpcHdrPtr->dataOffset,
  748.                rpcHdrPtr->numFrags,
  749.                rpcHdrPtr->fragMask);
  750.     fprintf(output, "\n");
  751.     }
  752.     PRINT_HEADER();
  753. }
  754.  
  755. /*
  756.  * PrintFlags --
  757.  *
  758.  *    Convert from bit flags to a character string and output it.
  759.  */
  760. PrintFlags(stream, flags, format)
  761.     FILE *stream;
  762.     int flags;
  763.     char *format;
  764. {
  765.     char c;
  766.     char string[10];
  767.     int index = 0;
  768.  
  769.     switch (flags & RPC_TYPE) {
  770.     case RPC_REQUEST: {
  771.         c = 'Q';
  772.         break;
  773.     }
  774.     case RPC_NACK: {
  775.         c = 'N';
  776.         break;
  777.     }
  778.     case RPC_ACK: {
  779.         c = 'A';
  780.         break;
  781.     }
  782.     case RPC_REPLY: {
  783.         c = 'R';
  784.         break;
  785.     }
  786.     case RPC_ECHO: {
  787.         c = 'E';
  788.         break;
  789.     }
  790.     default: {
  791.         c = '-';
  792.         break;
  793.     }
  794.     }
  795.     string[index] = c;
  796.     index++;
  797.     if (flags & RPC_PLSACK) {
  798.     string[index] = 'p';
  799.     index++;
  800.     }
  801.     if (flags & RPC_LASTFRAG) {
  802.     string[index] = 'f';
  803.     index++;
  804.     }
  805.     if (flags & RPC_CLOSE) {
  806.     string[index] = 'c';
  807.     index++;
  808.     }
  809.     if (flags & RPC_ERROR) {
  810.     string[index] = 'e';
  811.     index++;
  812.     }
  813.     
  814.     string[index] = '\0';
  815.     
  816.     fprintf(stream, format, string);
  817. }
  818.  
  819. /*
  820.  * PrintCommand --
  821.  *
  822.  *    Convert from procedure ID to procedure name and output it.
  823.  */
  824. PrintCommand(stream, command, format)
  825.     FILE *stream;
  826.     int command;
  827.     char *format;
  828. {
  829.     char buffer[128];
  830.     char *string;
  831.  
  832.     switch (command) {
  833.     case RPC_ECHO_1:
  834.         string = "echoIntr";
  835.         break;
  836.     case RPC_ECHO_2:
  837.         string = "echo";
  838.         break;
  839.     case RPC_SEND:
  840.         string = "send";
  841.         break;
  842.     case RPC_RECEIVE:
  843.         string = "recv";
  844.         break;
  845.     case RPC_GETTIME:
  846.         string = "get time";
  847.         break;
  848.     case RPC_FS_PREFIX:
  849.         string = "prefix";
  850.         break;
  851.     case RPC_FS_OPEN:
  852.         string = "open";
  853.         break;
  854.     case RPC_FS_READ:
  855.         string = "read";
  856.         break;
  857.     case RPC_FS_WRITE:
  858.         string = "write";
  859.         break;
  860.     case RPC_FS_CLOSE:
  861.         string = "close";
  862.         break;
  863.     case RPC_FS_UNLINK:
  864.         string = "remove";
  865.         break;
  866.     case RPC_FS_RENAME:
  867.         string = "rename";
  868.         break;
  869.     case RPC_FS_MKDIR:
  870.         string = "mkdir";
  871.         break;
  872.     case RPC_FS_RMDIR:
  873.         string = "rmdir";
  874.         break;
  875.     case RPC_FS_MKDEV:
  876.         string = "make dev";
  877.         break;
  878.     case RPC_FS_LINK:
  879.         string = "link";
  880.         break;
  881.     case RPC_FS_SYM_LINK:
  882.         string = "link";
  883.         break;
  884.     case RPC_FS_GET_ATTR:
  885.         string = "get attrID";
  886.         break;
  887.     case RPC_FS_SET_ATTR:
  888.         string = "set attrID";
  889.         break;
  890.     case RPC_FS_GET_ATTR_PATH:
  891.         string = "get attr";
  892.         break;
  893.     case RPC_FS_SET_ATTR_PATH:
  894.         string = "set attr";
  895.         break;
  896.     case RPC_FS_GET_IO_ATTR:
  897.         string = "getI/Oattr";
  898.         break;
  899.     case RPC_FS_SET_IO_ATTR:
  900.         string = "setI/Oattr";
  901.         break;
  902.     case RPC_FS_DEV_OPEN:
  903.         string = "dev open";
  904.         break;
  905.     case RPC_FS_SELECT:
  906.         string = "select";
  907.         break;
  908.     case RPC_FS_IO_CONTROL:
  909.         string = "ioctl";
  910.         break;
  911.     case RPC_FS_CONSIST:
  912.         string = "consist";
  913.         break;
  914.     case RPC_FS_CONSIST_REPLY:
  915.         string = "cnsst rply";
  916.         break;
  917.     case RPC_FS_COPY_BLOCK:
  918.         string = "block copy";
  919.         break;
  920.     case RPC_FS_MIGRATE:
  921.         string = "mig file";
  922.         break;
  923.     case RPC_FS_RELEASE:
  924.         string = "release";
  925.         break;
  926.     case RPC_FS_REOPEN:
  927.         string = "reopen";
  928.         break;
  929.     case RPC_FS_RECOVERY:
  930.         string = "recov";
  931.         break;
  932.     case RPC_FS_DOMAIN_INFO:
  933.         string = "domain info";
  934.         break;
  935.     case RPC_PROC_MIG_COMMAND:
  936.         string = "mig cmd";
  937.         break;
  938.     case RPC_PROC_REMOTE_CALL:
  939.         string = "mig call";
  940.         break;
  941.     case RPC_PROC_REMOTE_WAIT:
  942.         string = "wait";
  943.         break;
  944.     case RPC_PROC_GETPCB:
  945.         string = "wait";
  946.         break;
  947.     case RPC_REMOTE_WAKEUP:
  948.         string = "wakeup";
  949.         break;
  950.     case RPC_SIG_SEND:
  951.         string = "signal";
  952.         break;
  953.     case RPC_FS_RELEASE_NEW:
  954.         string = "release new";
  955.         break;
  956.     default: {
  957.         sprintf(buffer,"%d",command);
  958.         string = buffer;
  959.         break;
  960.     }
  961.     }
  962.     fprintf(stream, format, string);
  963. }
  964.  
  965. /*
  966.  * PrintType --
  967.  *
  968.  *    Format and print the type field of the trace record.
  969.  */
  970. PrintType(stream, type, format)
  971.     FILE *stream;
  972.     int type;
  973.     char *format;
  974. {
  975.     char *string;
  976.     char buffer[20];
  977.  
  978.     switch(type) {
  979.     case RPC_INPUT:
  980.         string = "in";
  981.         break;
  982.     case RPC_OUTPUT:
  983.         string = "out";
  984.         break;
  985.     case RPC_CLIENT_a:        /* Client interrupt time stamps */
  986.     case RPC_CLIENT_b:
  987.     case RPC_CLIENT_c:
  988.     case RPC_CLIENT_d:
  989.     case RPC_CLIENT_e:
  990.     case RPC_CLIENT_f:
  991.         sprintf(buffer, "Ci %c ", type - RPC_CLIENT_a + 'a');
  992.         string = buffer;
  993.         break;
  994.     case RPC_CLIENT_A:        /* Client process level time stamps */
  995.     case RPC_CLIENT_B:
  996.     case RPC_CLIENT_C:
  997.     case RPC_CLIENT_D:
  998.     case RPC_CLIENT_E:
  999.     case RPC_CLIENT_F:
  1000.         sprintf(buffer, "Cp %c ", type - RPC_CLIENT_A + 'A');
  1001.         string = buffer;
  1002.         break;
  1003.     case RPC_SERVER_a:        /* Server interrupt time stamps */
  1004.     case RPC_SERVER_b:
  1005.     case RPC_SERVER_c:
  1006.     case RPC_SERVER_d:
  1007.     case RPC_SERVER_e:
  1008.     case RPC_SERVER_f:
  1009.         sprintf(buffer, "Ci %c ", type - RPC_SERVER_a + 'a');
  1010.         string = buffer;
  1011.         break;
  1012.     case RPC_SERVER_A:        /* Server process level time stamps */
  1013.     case RPC_SERVER_B:
  1014.     case RPC_SERVER_C:
  1015.     case RPC_SERVER_D:
  1016.     case RPC_SERVER_E:
  1017.     case RPC_SERVER_F:
  1018.         sprintf(buffer, "Cp %c ", type - RPC_SERVER_A + 'A');
  1019.         string = buffer;
  1020.         break;
  1021.     case RPC_CLIENT_OUT:
  1022.         string = "Cexit";
  1023.         break;
  1024.     case RPC_SERVER_OUT:
  1025.         string = "Sexit";
  1026.         break;
  1027.     default:
  1028.         (void)sprintf(buffer,"%d",type);
  1029.         string = buffer;
  1030.     }
  1031.     fprintf(stream, format, string);
  1032. }
  1033.  
  1034.  
  1035. /*
  1036.  *----------------------------------------------------------------------
  1037.  *
  1038.  * PrintCltHist --
  1039.  *
  1040.  *    Print the client-side histogram numbers for each RPC command.
  1041.  *
  1042.  * Results:
  1043.  *    None.
  1044.  *
  1045.  * Side effects:
  1046.  *    None.
  1047.  *
  1048.  *----------------------------------------------------------------------
  1049.  */
  1050.  
  1051. static void
  1052. PrintCltHist()
  1053. {
  1054.     ReturnStatus status;
  1055.     int cmdNum;            /* RPC command number */
  1056.     Address buffer;        /* holds histogram struct & buckets */
  1057.     char rpcName[RPC_MAX_NAME_LENGTH];
  1058.  
  1059.     buffer = malloc(sizeof(Rpc_Histogram) +
  1060.             RPC_NUM_HIST_BUCKETS * sizeof(int));
  1061.  
  1062.     printf("RPC CLIENT HISTOGRAMS:\n");
  1063.     for (cmdNum = 1; cmdNum <= RPC_LAST_COMMAND; ++cmdNum) {
  1064.     Rpc_GetName(cmdNum, sizeof(rpcName), rpcName);
  1065.     status = Sys_Stats(SYS_RPC_CLIENT_HIST, cmdNum, buffer);
  1066.     if (status != SUCCESS) {
  1067.         fprintf(stderr,
  1068.             "Couldn't get clt histogram info for %s call (%d): %s\n",
  1069.             rpcName, cmdNum, Stat_GetMsg(status));
  1070.         return;
  1071.     }
  1072.     printf("  %s:\t", rpcName);
  1073.     PrintHist(buffer);
  1074.     }
  1075.  
  1076.     free(buffer);
  1077. }
  1078.  
  1079.  
  1080. /*
  1081.  *----------------------------------------------------------------------
  1082.  *
  1083.  * PrintSrvHist --
  1084.  *
  1085.  *    Print the server-side histogram numbers for each RPC command.
  1086.  *
  1087.  * Results:
  1088.  *    None.
  1089.  *
  1090.  * Side effects:
  1091.  *    None.
  1092.  *
  1093.  *----------------------------------------------------------------------
  1094.  */
  1095.  
  1096. static void
  1097. PrintSrvHist()
  1098. {
  1099.     ReturnStatus status;
  1100.     int cmdNum;            /* RPC command number */
  1101.     Address buffer;        /* holds histogram struct & buckets */
  1102.     char rpcName[RPC_MAX_NAME_LENGTH];
  1103.  
  1104.     buffer = malloc(sizeof(Rpc_Histogram) +
  1105.             RPC_NUM_HIST_BUCKETS * sizeof(int));
  1106.  
  1107.     printf("RPC SERVER HISTOGRAMS:\n");
  1108.     for (cmdNum = 1; cmdNum <= RPC_LAST_COMMAND; ++cmdNum) {
  1109.     Rpc_GetName(cmdNum, sizeof(rpcName), rpcName);
  1110.     status = Sys_Stats(SYS_RPC_SERVER_HIST, cmdNum, buffer);
  1111.     if (status != SUCCESS) {
  1112.         fprintf(stderr,
  1113.             "Couldn't get srv histogram info for %s call (%d): %s\n",
  1114.             rpcName, cmdNum, Stat_GetMsg(status));
  1115.         return;
  1116.     }
  1117.     printf("  %s:\t", rpcName);
  1118.     PrintHist(buffer);
  1119.     }
  1120.  
  1121.     free(buffer);
  1122. }
  1123.  
  1124.  
  1125. /*
  1126.  *----------------------------------------------------------------------
  1127.  *
  1128.  * PrintHist --
  1129.  *
  1130.  *    Print out numbers from a single histogram.
  1131.  *
  1132.  * Results:
  1133.  *    None.
  1134.  *
  1135.  * Side effects:
  1136.  *    None.
  1137.  *
  1138.  *----------------------------------------------------------------------
  1139.  */
  1140.  
  1141. static void
  1142. PrintHist(buffer)
  1143.     Address buffer;        /* histogram struct, followed by counters */
  1144. {
  1145.     Rpc_Histogram *histPtr;
  1146.     int *countPtr;
  1147.     int firstBucket;        /* number of first bucket in row */
  1148.     int numCols = 8;        /* number of columns in the table of counts */
  1149.     int column;            /* which column in the table */
  1150.  
  1151.     histPtr = (Rpc_Histogram *)buffer;
  1152.     countPtr = (int *)(buffer + sizeof(Rpc_Histogram));
  1153.  
  1154.     Time_Divide(histPtr->totalTime, histPtr->numCalls,
  1155.         &histPtr->aveTimePerCall);
  1156.     printf("%d Calls,  ave %d.%06d secs each (%d.%06d sec overhead)\n",
  1157.        histPtr->numCalls, histPtr->aveTimePerCall.seconds,
  1158.        histPtr->aveTimePerCall.microseconds,
  1159.        histPtr->overheadTime.seconds,
  1160.        histPtr->overheadTime.microseconds);
  1161.  
  1162.     firstBucket = 0;
  1163.     /* 
  1164.      * There are numBuckets + 1 buckets to print (the +1 is for the 
  1165.      * overflow bucket).
  1166.      */
  1167.     while (firstBucket < histPtr->numBuckets + 1) {
  1168.     for (column = 0; column < numCols; ++column) {
  1169.         if (firstBucket + column >= histPtr->numBuckets) {
  1170.         break;
  1171.         }
  1172.         printf("%8d ", (firstBucket + column) * histPtr->usecPerBucket);
  1173.     }
  1174.     if (column < numCols && firstBucket + column == histPtr->numBuckets) {
  1175.         printf("Overflow");
  1176.         ++column;
  1177.     }
  1178.     printf("\n");
  1179.     for (column = 0; column < numCols; ++column) {
  1180.         if (firstBucket + column >= histPtr->numBuckets) {
  1181.         break;
  1182.         }
  1183.         printf("%7d  ", countPtr[firstBucket+column]);
  1184.     }
  1185.     if (column < numCols && firstBucket + column == histPtr->numBuckets) {
  1186.         printf("%7d\n", histPtr->numHighValues);
  1187.         ++column;
  1188.     }
  1189.     printf("\n\n");
  1190.     firstBucket += column;
  1191.     }
  1192. }
  1193. @
  1194.  
  1195.  
  1196. 1.22
  1197. log
  1198. @Fix typo in comments & fix -chan so that it really prints the channel
  1199. number (instead of the server hint).
  1200. @
  1201. text
  1202. @d11 1
  1203. a11 1
  1204. static char rcsid[] = "$Header: /sprite/src/cmds/rpcstat/RCS/rpcstat.c,v 1.21 90/12/06 10:40:37 mendel Exp Locker: kupfer $ SPRITE (Berkeley)";
  1205. d16 1
  1206. d30 1
  1207. d39 2
  1208. d53 4
  1209. d65 1
  1210. a65 4
  1211. /* 
  1212.  * Forward references:
  1213.  */
  1214. static void PrintQuad();
  1215. d67 3
  1216. d113 6
  1217. d888 160
  1218. @
  1219.  
  1220.  
  1221. 1.21
  1222. log
  1223. @Added the nohostdb option.
  1224. @
  1225. text
  1226. @d11 1
  1227. a11 1
  1228. static char rcsid[] = "$Header: /sprite/src/cmds/rpcstat/RCS/rpcstat.c,v 1.20 90/11/29 22:21:22 kupfer Exp Locker: mendel $ SPRITE (Berkeley)";
  1229. d250 1
  1230. a250 1
  1231.  * PrintServerState --
  1232. d280 1
  1233. a280 1
  1234.     printf("%-8d ", chanPtr->requestRpcHdr.serverHint);
  1235. @
  1236.  
  1237.  
  1238. 1.21.1.1
  1239. log
  1240. @Initial branch for Sprite server.
  1241. @
  1242. text
  1243. @d11 1
  1244. a11 1
  1245. static char rcsid[] = "$Header: /sprite/src/cmds/rpcstat/RCS/rpcstat.c,v 1.21 90/12/06 10:40:37 mendel Exp $ SPRITE (Berkeley)";
  1246. @
  1247.  
  1248.  
  1249. 1.20
  1250. log
  1251. @Fold Mary's "extra" server stats into the regular server stats.
  1252. @
  1253. text
  1254. @d11 1
  1255. a11 1
  1256. static char rcsid[] = "$Header: /sprite/src/cmds/rpcstat/RCS/rpcstat.c,v 1.19 90/11/20 17:19:55 mgbaker Exp Locker: kupfer $ SPRITE (Berkeley)";
  1257. d39 1
  1258. d51 1
  1259. d463 10
  1260. a472 1
  1261.     entryPtr = Host_ByID(spriteID);
  1262. @
  1263.  
  1264.  
  1265. 1.19
  1266. log
  1267. @Checking this in for Mike K.
  1268. @
  1269. text
  1270. @d11 1
  1271. a11 1
  1272. static char rcsid[] = "$Header: /sprite/src/cmds/rpcstat/RCS/rpcstat.c,v 1.18 90/07/03 17:12:17 mgbaker Exp Locker: mgbaker $ SPRITE (Berkeley)";
  1273. d14 15
  1274. a28 15
  1275. #include "sprite.h"
  1276. #include "stdio.h"
  1277. #include "sysStats.h"
  1278. #include "option.h"
  1279. #include "kernel/sched.h"
  1280. #include "vmStat.h"
  1281. #include "host.h"
  1282. #include "kernel/sync.h"
  1283. #include "kernel/timer.h"
  1284. #include "kernel/rpcClient.h"
  1285. #include "kernel/rpcServer.h"
  1286. #include "kernel/rpcCltStat.h"
  1287. #include "kernel/rpcSrvStat.h"
  1288. #include "kernel/rpcTrace.h"
  1289. #include "kernel/rpcCall.h"
  1290. a37 1
  1291. Boolean    doExtraSrvStats = FALSE;
  1292. a49 1
  1293.     {OPT_TRUE, "sinfoExtra", (Address)&doExtraSrvStats, "Print extra server process statistics"},
  1294. d55 2
  1295. a56 2
  1296. /*
  1297.  * Copy of the rpc trace table.
  1298. d58 1
  1299. a58 1
  1300. Rpc_Trace rpc_Trace[RPC_TRACE_LEN];
  1301. a96 3
  1302.     if (doExtraSrvStats) {
  1303.     PrintExtraServerStats();
  1304.     }
  1305. d210 2
  1306. d213 2
  1307. a214 1
  1308.     printf("invClient   = %4d ", rpcSrvStat.invClient);
  1309. a247 31
  1310.  * PrintExtraServerStats --
  1311.  *
  1312.  *    Prints out the extra low-level statistics for the service side
  1313.  *    of the RPC system.
  1314.  *
  1315.  * Results:
  1316.  *    None.
  1317.  *
  1318.  * Side effects:
  1319.  *    None.
  1320.  *
  1321.  *----------------------------------------------------------------------
  1322.  */
  1323.  
  1324. PrintExtraServerStats()
  1325. {
  1326.     int sillyArray[2];
  1327.  
  1328.     status = Sys_Stats(SYS_RPC_EXTRA_SRV_STATS, TRUE, sillyArray);
  1329.     if (status != SUCCESS) {
  1330.     return;
  1331.     }
  1332.     printf("Rpc Extra Server Statistics\n");
  1333.     printf("mostNackBufs   = %5d  selfNacksDropped   = %5d ", sillyArray[0],
  1334.         sillyArray[1]);
  1335.     printf("\n");
  1336. }
  1337.  
  1338. /*
  1339.  *----------------------------------------------------------------------
  1340.  *
  1341. a266 1
  1342.     Host_Entry *entryPtr;
  1343. d397 1
  1344. a499 1
  1345.     int rpcTraceIndex;        /* index of oldest record in the table */
  1346. @
  1347.  
  1348.  
  1349. 1.19.1.1
  1350. log
  1351. @Support for getting RPC traffic (per-call bytes-in and bytes-out) from
  1352. the server stats.
  1353. @
  1354. text
  1355. @d11 1
  1356. a11 1
  1357. static char rcsid[] = "$Header: /sprite/src/cmds/rpcstat/RCS/rpcstat.c,v 1.19 90/11/20 17:19:55 mgbaker Exp Locker: kupfer $ SPRITE (Berkeley)";
  1358. d14 15
  1359. a28 15
  1360. #include <sprite.h>
  1361. #include <stdio.h>
  1362. #include <sysStats.h>
  1363. #include <option.h>
  1364. #include <kernel/sched.h>
  1365. #include <vmStat.h>
  1366. #include <host.h>
  1367. #include <kernel/sync.h>
  1368. #include <kernel/timer.h>
  1369. #include <kernel/rpcClient.h>
  1370. #include <kernel/rpcServer.h>
  1371. #include <kernel/rpcCltStat.h>
  1372. #include <kernel/rpcSrvStat.h>
  1373. #include <kernel/rpcTrace.h>
  1374. #include <kernel/rpcCall.h>
  1375. a36 1
  1376. Boolean doSrvBytes = FALSE;
  1377. d38 1
  1378. a48 2
  1379.     {OPT_TRUE, "rpcbytes", (Address)&doSrvBytes,
  1380.      "Print number of bytes for RPCs to this host"},
  1381. d51 1
  1382. d57 2
  1383. a58 2
  1384. /* 
  1385.  * Forward references:
  1386. d60 1
  1387. a60 1
  1388. static void PrintQuad();
  1389. d99 3
  1390. a107 3
  1391.     if (doSrvBytes) {
  1392.     PrintSrvBytes();
  1393.     }
  1394. d213 62
  1395. a274 3
  1396.     printf("toServer        = %5d ", rpcSrvStat.toServer);
  1397.     printf("noAlloc          = %4d ", rpcSrvStat.noAlloc);
  1398.     printf("invClient        = %4d ", rpcSrvStat.invClient);
  1399. a275 31
  1400.     printf("nacks            = %4d ", rpcSrvStat.nacks);
  1401.     printf("mostNackBuffers  = %4d ", rpcSrvStat.mostNackBuffers);
  1402.     printf("selfNacks        = %4d ", rpcSrvStat.selfNacks);
  1403.     printf("\n");
  1404.     printf("serverBusy       = %4d ", rpcSrvStat.serverBusy);
  1405.     printf("requests        = %5d ", rpcSrvStat.requests);
  1406.     printf("impAcks         = %5d ", rpcSrvStat.impAcks);
  1407.     printf("handoffs        = %5d ", rpcSrvStat.handoffs);
  1408.     printf("\n");
  1409.     printf("fragMsgs        = %5d ", rpcSrvStat.fragMsgs);
  1410.     printf("handoffAcks      = %4d ", rpcSrvStat.handoffAcks);
  1411.     printf("fragAcks         = %4d ", rpcSrvStat.fragAcks);
  1412.     printf("sentPartial      = %4d ", rpcSrvStat.recvPartial);
  1413.     printf("\n");
  1414.     printf("busyAcks         = %4d ", rpcSrvStat.busyAcks);
  1415.     printf("resends          = %4d ", rpcSrvStat.resends);
  1416.     printf("badState         = %4d ", rpcSrvStat.badState);
  1417.     printf("extra            = %4d ", rpcSrvStat.extra);
  1418.     printf("\n");
  1419.     printf("reclaims         = %4d ", rpcSrvStat.reclaims);
  1420.     printf("reassembly      = %5d ", rpcSrvStat.reassembly);
  1421.     printf("dupFrag          = %4d ", rpcSrvStat.dupFrag);
  1422.     printf("nonFrag          = %4d ", rpcSrvStat.nonFrag);
  1423.     printf("\n");
  1424.     printf("fragAborts       = %4d ", rpcSrvStat.fragAborts);
  1425.     printf("recvPartial      = %4d ", rpcSrvStat.recvPartial);
  1426.     printf("closeAcks        = %4d ", rpcSrvStat.closeAcks);
  1427.     printf("discards         = %4d ", rpcSrvStat.discards);
  1428.     printf("\n");
  1429.     printf("unknownAcks      = %4d ", rpcSrvStat.unknownAcks);
  1430.     printf("\n");
  1431. d300 1
  1432. a434 45
  1433.  * PrintServerBytes --
  1434.  *
  1435.  *    Prints out the number of bytes received and sent for RPC calls 
  1436.  *    to this (server) host.
  1437.  *
  1438.  * Results:
  1439.  *    None.
  1440.  *
  1441.  * Side effects:
  1442.  *    None.
  1443.  *
  1444.  *----------------------------------------------------------------------
  1445.  */
  1446.  
  1447. PrintSrvBytes()
  1448. {
  1449.     Rpc_SrvStat rpcSrvStat;
  1450.     int call;
  1451.  
  1452.     status = Sys_Stats(SYS_RPC_SRV_STATS, TRUE, &rpcSrvStat);
  1453.     if (status != SUCCESS) {
  1454.     return;
  1455.     }
  1456.  
  1457.     printf("RPC bytes for this server\n");
  1458.     for (call=0 ; call<=RPC_LAST_COMMAND ; call++) {
  1459.     u_quad bytesIn;
  1460.     u_quad bytesOut;
  1461.  
  1462.     bytesIn = rpcSrvStat.toServerBytes[call];
  1463.     bytesOut = rpcSrvStat.fromServerBytes[call];
  1464.     if (zero || !QUAD_IS_ZERO(bytesIn) || !QUAD_IS_ZERO(bytesOut)) {
  1465.         PrintCommand(stdout, call, "%-15s");
  1466.         printf("\t");
  1467.         PrintQuad(bytesIn);
  1468.         printf("(in) \t");
  1469.         PrintQuad(bytesOut);
  1470.         printf("(out)\n");
  1471.     }
  1472.     }
  1473. }
  1474.  
  1475. /*
  1476.  *----------------------------------------------------------------------
  1477.  *
  1478. d533 1
  1479. a896 29
  1480. }
  1481.  
  1482. /*
  1483.  *----------------------------------------------------------------------
  1484.  *
  1485.  * PrintQuad --
  1486.  *
  1487.  *    Print the value of a 64-bit unsigned integer.
  1488.  *
  1489.  * Results:
  1490.  *    None.
  1491.  *
  1492.  * Side effects:
  1493.  *    The integer has been printed on stdout.
  1494.  *
  1495.  *----------------------------------------------------------------------
  1496.  */
  1497.  
  1498. static void
  1499. PrintQuad(myQuad)
  1500.     u_quad myQuad;
  1501. {
  1502.     printf("0x");
  1503.     if (myQuad.val[1] == 0) {
  1504.     printf("%x", myQuad.val[0]);
  1505.     } else {
  1506.     printf("%x", myQuad.val[1]);
  1507.     printf("%08x", myQuad.val[0]);
  1508.     }
  1509. @
  1510.  
  1511.  
  1512. 1.18
  1513. log
  1514. @Some extra server stats.
  1515. @
  1516. text
  1517. @d11 1
  1518. a11 1
  1519. static char rcsid[] = "$Header: /sprite/src/cmds/rpcstat/RCS/rpcstat.c,v 1.17 89/07/01 12:17:05 brent Exp Locker: mgbaker $ SPRITE (Berkeley)";
  1520. d817 3
  1521. @
  1522.  
  1523.  
  1524. 1.17
  1525. log
  1526. @Added support for SRV_STUCK
  1527. @
  1528. text
  1529. @d11 1
  1530. a11 1
  1531. static char rcsid[] = "$Header: /a/newcmds/rpcstat/RCS/rpcstat.c,v 1.16 89/06/23 13:41:16 brent Exp $ SPRITE (Berkeley)";
  1532. d38 1
  1533. d51 1
  1534. d99 3
  1535. d150 3
  1536. d154 1
  1537. a157 1
  1538.     printf("\n");
  1539. d160 1
  1540. a162 1
  1541.     printf("\n");
  1542. d165 1
  1543. a166 1
  1544.     printf("\n");
  1545. d171 6
  1546. d179 1
  1547. a180 1
  1548.     printf("paramOverrun = %3d ", rpcCltStat.paramOverrun);
  1549. d215 1
  1550. d217 1
  1551. a218 1
  1552.     printf("\n");
  1553. d222 1
  1554. a223 1
  1555.     printf("\n");
  1556. d227 1
  1557. a228 1
  1558.     printf("\n");
  1559. d232 1
  1560. a233 1
  1561.     printf("\n");
  1562. d237 1
  1563. a238 1
  1564.     printf("\n");
  1565. d242 1
  1566. d250 31
  1567. d637 4
  1568. @
  1569.  
  1570.  
  1571. 1.16
  1572. log
  1573. @Fixed typo
  1574. @
  1575. text
  1576. @d11 1
  1577. a11 1
  1578. static char rcsid[] = "$Header: /a/newcmds/rpcstat/RCS/rpcstat.c,v 1.15 89/06/23 13:19:31 brent Exp Locker: brent $ SPRITE (Berkeley)";
  1579. d324 3
  1580. @
  1581.  
  1582.  
  1583. 1.15
  1584. log
  1585. @Added call and rpc counts.
  1586. Patched SrvState and CltState routines because the kernel
  1587. is returning too much data.
  1588. @
  1589. text
  1590. @d11 1
  1591. a11 1
  1592. static char rcsid[] = "$Header: /a/newcmds/rpcstat/RCS/rpcstat.c,v 1.14 89/06/16 08:48:31 brent Exp Locker: brent $ SPRITE (Berkeley)";
  1593. d48 1
  1594. a48 1
  1595.     {OPT_TRUE, "zero", (Address)&zero, "Print zero valued stats\n"},
  1596. @
  1597.  
  1598.  
  1599. 1.14
  1600. log
  1601. @Updated to new RPC numbering
  1602. @
  1603. text
  1604. @d11 1
  1605. a11 1
  1606. static char rcsid[] = "$Header: /a/newcmds/rpcstat/RCS/rpcstat.c,v 1.13 89/05/15 17:50:30 mendel Exp $ SPRITE (Berkeley)";
  1607. a33 3
  1608. Boolean doSyncStat = FALSE;
  1609. Boolean doSchedStat = FALSE;
  1610. Boolean doVmStat = FALSE;
  1611. d35 4
  1612. d41 9
  1613. a49 8
  1614.     {OPT_TRUE, "t", (Address)&doRpcTrace, "Print trace of RPCs"},
  1615.     {OPT_TRUE, "C", (Address)&doCltStats, "Print client RPC statistics"},
  1616.     {OPT_TRUE, "S", (Address)&doSrvStats, "Print server RPC statistics"},
  1617.     {OPT_TRUE, "c", (Address)&doCltState, "Print client channel state"},
  1618.     {OPT_TRUE, "s", (Address)&doSrvState, "Print server process state"},
  1619.     {OPT_TRUE, "x", (Address)&doSchedStat, "Print scheduling statistics"},
  1620.     {OPT_TRUE, "l", (Address)&doSyncStat, "Print lock (Sync) statistics"},
  1621.     {OPT_TRUE, "v", (Address)&doVmStat, "Print VM statistics"},
  1622. d61 17
  1623. d97 2
  1624. a98 2
  1625.     if (doSyncStat) {
  1626.     PrintSyncStats();
  1627. d100 2
  1628. a101 2
  1629.     if (doSchedStat) {
  1630.     PrintSchedStats();
  1631. a102 3
  1632.     if (doVmStat) {
  1633.     PrintVmStats();
  1634.     }
  1635. d109 17
  1636. d173 17
  1637. d231 16
  1638. d251 2
  1639. a252 1
  1640.     RpcClientChannel channel;
  1641. d258 1
  1642. a258 1
  1643.     status = Sys_Stats(SYS_RPC_CLT_STATE, index, (Address)&channel);
  1644. d263 4
  1645. a266 4
  1646.     PrintCommand(stdout, channel.requestRpcHdr.command, " %-10s ");
  1647.     PrintHostName(channel.serverID, " %-15s ");
  1648.     printf("%-8d ", channel.requestRpcHdr.serverHint);
  1649.     if (channel.state == CHAN_FREE) {
  1650. d269 1
  1651. a269 1
  1652.     if (channel.state & CHAN_BUSY) {
  1653. d272 1
  1654. a272 1
  1655.     if (channel.state & CHAN_WAITING) {
  1656. d275 1
  1657. a275 1
  1658.     if (channel.state & CHAN_INPUT) {
  1659. d278 1
  1660. a278 1
  1661.     if (channel.state & CHAN_TIMEOUT) {
  1662. d285 16
  1663. d305 2
  1664. a306 1
  1665.     RpcServerState server;
  1666. d311 1
  1667. a311 1
  1668.     status = Sys_Stats(SYS_RPC_SRV_STATE, index, (Address)&server);
  1669. d316 4
  1670. a319 4
  1671.     PrintCommand(stdout, server.requestRpcHdr.command, " %-10s ");
  1672.     PrintHostName(server.clientID, " %-15s ");
  1673.     printf("%-8d ", server.channel);
  1674.     if (server.state == SRV_NOTREADY) {
  1675. d322 1
  1676. a322 1
  1677.     if (server.state & SRV_FREE) {
  1678. d325 1
  1679. a325 1
  1680.     if (server.state & SRV_BUSY) {
  1681. d328 1
  1682. a328 1
  1683.     if (server.state & SRV_WAITING) {
  1684. d331 2
  1685. a332 2
  1686.     if (server.state & SRV_AGING) {
  1687.         printf("aging (%d) ", server.age);
  1688. d334 1
  1689. a334 1
  1690.     if (server.state & SRV_NO_REPLY) {
  1691. d337 1
  1692. a337 1
  1693.     if (server.state & SRV_FRAGMENT) {
  1694. d344 92
  1695. a461 61
  1696. PrintSyncStats()
  1697. {
  1698.     Sync_Instrument syncStat;
  1699.     status = Sys_Stats(SYS_SYNC_STATS, 0, &syncStat);
  1700.     if (status != SUCCESS) {
  1701.     return;
  1702.     }
  1703.     printf("Sync Statistics\n");
  1704.     printf("numWakeups = %d ", syncStat.numWakeups);
  1705.     printf("numWakeupCalls = %d ", syncStat.numWakeupCalls);
  1706.     printf("numSpuriousWakeups = %d ", syncStat.numSpuriousWakeups);
  1707.     printf("numLocks = %d ", syncStat.numLocks);
  1708.     printf("numUnlocks = %d ", syncStat.numUnlocks);
  1709.     printf("\n");
  1710. }
  1711.  
  1712. PrintSchedStats()
  1713. {
  1714.     Sched_Instrument schedStat;
  1715.     Time idleTime;
  1716.  
  1717.     status = Sys_Stats(SYS_SCHED_STATS, 0, &schedStat);
  1718.     if (status != SUCCESS) {
  1719.     return;
  1720.     }
  1721.     printf("Sched Statistics\n");
  1722.     printf("numContextSwitches = %d\n", 
  1723.         schedStat.processor[0].numContextSwitches);
  1724.     printf("numFullSwitches    = %d\n", schedStat.processor[0].numFullCS);
  1725.     printf("numInvoluntary     = %d\n", 
  1726.         schedStat.processor[0].numInvoluntarySwitches);
  1727.     printf("Idle Time          = %d.%06d seconds\n",
  1728.            schedStat.processor[0].idleTime.seconds,
  1729.            schedStat.processor[0].idleTime.microseconds);
  1730. }
  1731.  
  1732. PrintVmStats()
  1733. {
  1734.     Vm_Stat vmStat;
  1735.     status = Sys_Stats(SYS_VM_STATS, 0, &vmStat);
  1736.     if (status != SUCCESS) {
  1737.     return;
  1738.     }
  1739.     printf("VM Statistics\n");
  1740.     printf("totalFaults      = %d\n", vmStat.totalFaults);
  1741.     printf("totalUserFaults  = %d\n", vmStat.totalUserFaults);
  1742.     printf("zeroFilled       = %d\n", vmStat.zeroFilled);
  1743.     printf("fsFilled         = %d\n", vmStat.fsFilled);
  1744.     printf("psFilled         = %d\n", vmStat.psFilled);
  1745.     printf("collFaults       = %d\n", vmStat.collFaults);
  1746.     printf("quickFaults      = %d\n", vmStat.quickFaults);
  1747.     printf("code faults      = %d\n", vmStat.codeFaults);
  1748.     printf("heap faults      = %d\n", vmStat.heapFaults);
  1749.     printf("stack faults     = %d\n", vmStat.stackFaults);
  1750.     printf("pagesWritten     = %d\n", vmStat.pagesWritten);
  1751.     printf("cleanWait        = %d\n", vmStat.cleanWait);
  1752.     printf("pageoutWakeup    = %d\n", vmStat.pageoutWakeup);
  1753.     printf("pageoutNoWork    = %d\n", vmStat.pageoutNoWork);
  1754.     printf("pageoutWait      = %d\n", vmStat.pageoutWait);
  1755.     printf("mapPageWait      = %d\n", vmStat.mapPageWait);
  1756.     printf("accessWait       = %d\n", vmStat.accessWait);
  1757. d463 14
  1758. a476 1
  1759.  * need a machine type id before we can print out the maching dependent part.
  1760. a477 2
  1761. }
  1762.  
  1763. @
  1764.  
  1765.  
  1766. 1.13
  1767. log
  1768. @Updated this to produce host names, not numbers (brent)
  1769. @
  1770. text
  1771. @d11 1
  1772. a11 1
  1773. static char rcsid[] = "$Header: /a/newcmds/rpcstat/RCS/rpcstat.c,v 1.12 88/12/22 11:06:53 douglis Exp Locker: mendel $ SPRITE (Berkeley)";
  1774. d530 6
  1775. d560 3
  1776. d566 2
  1777. a567 2
  1778.     case RPC_GETTIME:
  1779.         string = "get time";
  1780. a568 3
  1781.     case RPC_FS_PREFIX:
  1782.         string = "prefix";
  1783.         break;
  1784. a586 12
  1785.     case RPC_PROC_MIG_COMMAND:
  1786.         string = "mig cmd";
  1787.         break;
  1788.     case RPC_PROC_REMOTE_CALL:
  1789.         string = "mig call";
  1790.         break;
  1791.     case RPC_FS_MIGRATE:
  1792.         string = "mig file";
  1793.         break;
  1794.     case RPC_FS_CONSIST:
  1795.         string = "consist";
  1796.         break;
  1797. a589 6
  1798.     case RPC_REMOTE_WAKEUP:
  1799.         string = "wakeup";
  1800.         break;
  1801.     case RPC_PROC_REMOTE_WAIT:
  1802.         string = "wait";
  1803.         break;
  1804. d596 3
  1805. d605 2
  1806. a606 2
  1807.     case RPC_FS_MKDEV:
  1808.         string = "make dev";
  1809. d608 2
  1810. a609 2
  1811.     case RPC_SIG_SEND:
  1812.         string = "signal";
  1813. d614 3
  1814. d618 13
  1815. a630 1
  1816.         string = "disk info";
  1817. d632 2
  1818. a633 2
  1819.     case RPC_FS_DEV_REOPEN:
  1820.         string = "reopen dev";
  1821. d635 2
  1822. a636 2
  1823.     case RPC_FS_RECOVERY:
  1824.         string = "recov";
  1825. @
  1826.  
  1827.  
  1828. 1.12
  1829. log
  1830. @changed references to include subscripts (but only for processor 0).
  1831. @
  1832. text
  1833. @d11 1
  1834. a11 1
  1835. static char rcsid[] = "$Header: /a/newcmds/rpcstat/RCS/rpcstat.c,v 1.11 88/11/23 08:54:27 ouster Exp Locker: douglis $ SPRITE (Berkeley)";
  1836. d19 2
  1837. a20 1
  1838. #include "kernel/vmStat.h"
  1839. d186 1
  1840. d188 2
  1841. a189 1
  1842.     printf("%2s %7s %-8s state\n", "I", "Server", "RPC");
  1843. a195 2
  1844.     printf("%3d/%3d ", channel.serverID,
  1845.                 channel.requestRpcHdr.serverHint);
  1846. d197 2
  1847. d200 1
  1848. a200 1
  1849.         printf(" free");
  1850. d203 1
  1851. a203 1
  1852.         printf(" busy");
  1853. d206 1
  1854. a206 1
  1855.         printf(" wait");
  1856. d209 1
  1857. a209 1
  1858.         printf(" input");
  1859. d212 1
  1860. a212 1
  1861.         printf(" timeout");
  1862. d224 2
  1863. a225 1
  1864.     printf("%2s %7s %-8s state\n", "I", "Client", "RPC");
  1865. a231 1
  1866.     printf("%3d/%3d ", server.clientID, server.channel);
  1867. d233 2
  1868. d248 4
  1869. a251 1
  1870.         printf("age %d ", server.age);
  1871. d256 25
  1872. a280 2
  1873.     if (server.state & SRV_NO_REPLY) {
  1874.         printf("no reply ");
  1875. d282 1
  1876. a282 1
  1877.     printf("\n");
  1878. d312 5
  1879. a316 3
  1880.     printf("numContextSwitches = %d\n", schedStat.numContextSwitches[0]);
  1881.     printf("numFullSwitches    = %d\n", schedStat.numFullCS[0]);
  1882.     printf("numInvoluntary     = %d\n", schedStat.numInvoluntarySwitches[0]);
  1883. d318 2
  1884. a319 2
  1885.            schedStat.idleTime[0].seconds,
  1886.            schedStat.idleTime[0].microseconds);
  1887. d581 2
  1888. a582 5
  1889.     case RPC_PROC_MIG_INIT:
  1890.         string = "mig init";
  1891.         break;
  1892.     case RPC_PROC_MIG_INFO:
  1893.         string = "mig info";
  1894. @
  1895.  
  1896.  
  1897. 1.11
  1898. log
  1899. @Change to accomodate new scheduler structure.  However, this change
  1900. only works for uniprocessors.
  1901. @
  1902. text
  1903. @d11 1
  1904. a11 1
  1905. static char rcsid[] = "$Header: /a/newcmds/rpcstat/RCS/rpcstat.c,v 1.10 88/10/31 14:45:08 brent Exp $ SPRITE (Berkeley)";
  1906. d281 3
  1907. a283 3
  1908.     printf("numContextSwitches = %d\n", schedStat.numContextSwitches);
  1909.     printf("numFullSwitches    = %d\n", schedStat.numFullCS);
  1910.     printf("numInvoluntary     = %d\n", schedStat.numInvoluntarySwitches);
  1911. @
  1912.  
  1913.  
  1914. 1.10
  1915. log
  1916. @Fixed call to Opt_Parse
  1917. @
  1918. text
  1919. @d11 1
  1920. a11 1
  1921. static char rcsid[] = "$Header: /a/newcmds/rpcstat/RCS/rpcStat.c,v 1.9 88/10/31 13:40:21 mendel Exp $ SPRITE (Berkeley)";
  1922. d285 2
  1923. a286 1
  1924.            schedStat.idleTime.seconds, schedStat.idleTime.microseconds);
  1925. @
  1926.  
  1927.  
  1928. 1.9
  1929. log
  1930. @Ported to use new libc.a.
  1931. @
  1932. text
  1933. @d11 1
  1934. a11 1
  1935. static char rcsid[] = "$Header: rpcStat.c,v 1.8 88/10/03 12:05:15 brent Exp $ SPRITE (Berkeley)";
  1936. d63 1
  1937. a63 1
  1938.     Opt_Parse(argc, argv,  optionArray, numOptions, 0);
  1939. @
  1940.  
  1941.  
  1942. 1.8
  1943. log
  1944. @*** empty log message ***
  1945. @
  1946. text
  1947. @d11 1
  1948. a11 1
  1949. static char rcsid[] = "$Header: rpcStat.c,v 1.7 87/10/06 09:31:45 brent Exp $ SPRITE (Berkeley)";
  1950. d15 1
  1951. a15 1
  1952. #include "fs.h"
  1953. a16 1
  1954. #include "io.h"
  1955. a17 1
  1956. #include "cvt.h"
  1957. d39 8
  1958. a46 8
  1959.     {OPT_TRUE, 't', (Address)&doRpcTrace, "Print trace of RPCs"},
  1960.     {OPT_TRUE, 'C', (Address)&doCltStats, "Print client RPC statistics"},
  1961.     {OPT_TRUE, 'S', (Address)&doSrvStats, "Print server RPC statistics"},
  1962.     {OPT_TRUE, 'c', (Address)&doCltState, "Print client channel state"},
  1963.     {OPT_TRUE, 's', (Address)&doSrvState, "Print server process state"},
  1964.     {OPT_TRUE, 'x', (Address)&doSchedStat, "Print scheduling statistics"},
  1965.     {OPT_TRUE, 'l', (Address)&doSyncStat, "Print lock (Sync) statistics"},
  1966.     {OPT_TRUE, 'v', (Address)&doVmStat, "Print VM statistics"},
  1967. a61 1
  1968.     int status = SUCCESS;
  1969. d63 1
  1970. a63 2
  1971.     Opt_Parse(&argc, argv, numOptions, optionArray);
  1972.     Io_Print("Rpc Stats: %s\n", Version());
  1973. d89 1
  1974. a89 1
  1975.     Proc_Exit(status);
  1976. d100 17
  1977. a116 17
  1978.     Io_Print("Rpc Client Statistics\n");
  1979.     Io_Print("toClient   = %5d ", rpcCltStat.toClient);
  1980.     Io_Print("badChannel  = %4d ", rpcCltStat.badChannel);
  1981.     Io_Print("chanBusy    = %4d ", rpcCltStat.chanBusy);
  1982.     Io_Print("badId       = %4d ", rpcCltStat.badId);
  1983.     Io_Print("\n");
  1984.     Io_Print("requests   = %5d ", rpcCltStat.requests);
  1985.     Io_Print("replies    = %5d ", rpcCltStat.replies);
  1986.     Io_Print("acks        = %4d ", rpcCltStat.acks);
  1987.     Io_Print("recvPartial = %4d ", rpcCltStat.recvPartial);
  1988.     Io_Print("\n");
  1989.     Io_Print("timeouts    = %4d ", rpcCltStat.timeouts);
  1990.     Io_Print("aborts      = %4d ", rpcCltStat.aborts);
  1991.     Io_Print("resends     = %4d ", rpcCltStat.resends);
  1992.     Io_Print("sentPartial = %4d ", rpcCltStat.sentPartial);
  1993.     Io_Print("\n");
  1994.     Io_Print("errors      = %d(%d)", rpcCltStat.errors,
  1995. d118 19
  1996. a136 19
  1997.     Io_Print("dupFrag     = %4d ", rpcCltStat.dupFrag);
  1998.     Io_Print("close       = %4d ", rpcCltStat.close);
  1999.     Io_Print("\n");
  2000.     Io_Print("oldInputs   = %4d ", rpcCltStat.oldInputs);
  2001.     Io_Print("badInputs   = %4d ", rpcCltStat.oldInputs);
  2002.     Io_Print("tooManyAcks = %4d ", rpcCltStat.tooManyAcks);
  2003.     Io_Print("\n");
  2004.     Io_Print("chanHits   = %5d ", rpcCltStat.chanHits);
  2005.     Io_Print("chanNew     = %4d ", rpcCltStat.chanNew);
  2006.     Io_Print("chanReuse   = %4d ", rpcCltStat.chanReuse);
  2007.     Io_Print("\n");
  2008.     Io_Print("chanWaits   = %4d ", rpcCltStat.chanWaits);
  2009.     Io_Print("chanBroads  = %4d ", rpcCltStat.chanBroads);
  2010.     Io_Print("\n");
  2011.     Io_Print("paramOverrun = %3d ", rpcCltStat.paramOverrun);
  2012.     Io_Print("dataOverrun = %4d ", rpcCltStat.dataOverrun);
  2013.     Io_Print("shorts      = %4d ", rpcCltStat.shorts);
  2014.     Io_Print("longs       = %4d ", rpcCltStat.longs);
  2015.     Io_Print("\n");
  2016. d147 31
  2017. a177 31
  2018.     Io_Print("Rpc Server Statistics\n");
  2019.     Io_Print("toServer   = %5d ", rpcSrvStat.toServer);
  2020.     Io_Print("noAlloc     = %4d ", rpcSrvStat.noAlloc);
  2021.     Io_Print("invClient   = %4d ", rpcSrvStat.invClient);
  2022.     Io_Print("serverBusy  = %4d ", rpcSrvStat.serverBusy);
  2023.     Io_Print("\n");
  2024.     Io_Print("requests   = %5d ", rpcSrvStat.requests);
  2025.     Io_Print("impAcks    = %5d ", rpcSrvStat.impAcks);
  2026.     Io_Print("handoffs   = %5d ", rpcSrvStat.handoffs);
  2027.     Io_Print("fragMsgs   = %5d ", rpcSrvStat.fragMsgs);
  2028.     Io_Print("\n");
  2029.     Io_Print("handoffAcks = %4d ", rpcSrvStat.handoffAcks);
  2030.     Io_Print("fragAcks    = %4d ", rpcSrvStat.fragAcks);
  2031.     Io_Print("sentPartial = %4d ", rpcSrvStat.recvPartial);
  2032.     Io_Print("busyAcks    = %4d ", rpcSrvStat.busyAcks);
  2033.     Io_Print("\n");
  2034.     Io_Print("resends     = %4d ", rpcSrvStat.resends);
  2035.     Io_Print("badState    = %4d ", rpcSrvStat.badState);
  2036.     Io_Print("extra       = %4d ", rpcSrvStat.extra);
  2037.     Io_Print("reclaims    = %4d ", rpcSrvStat.reclaims);
  2038.     Io_Print("\n");
  2039.     Io_Print("reassembly = %5d ", rpcSrvStat.reassembly);
  2040.     Io_Print("dupFrag     = %4d ", rpcSrvStat.dupFrag);
  2041.     Io_Print("nonFrag     = %4d ", rpcSrvStat.nonFrag);
  2042.     Io_Print("fragAborts  = %4d ", rpcSrvStat.fragAborts);
  2043.     Io_Print("\n");
  2044.     Io_Print("recvPartial = %4d ", rpcSrvStat.recvPartial);
  2045.     Io_Print("closeAcks   = %4d ", rpcSrvStat.closeAcks);
  2046.     Io_Print("discards    = %4d ", rpcSrvStat.discards);
  2047.     Io_Print("unknownAcks = %4d ", rpcSrvStat.unknownAcks);
  2048.     Io_Print("\n");
  2049. d186 1
  2050. a186 1
  2051.     Io_Print("%2s %7s %-8s state\n", "I", "Server", "RPC");
  2052. d192 2
  2053. a193 2
  2054.     Io_Print("%2d ", index);
  2055.     Io_Print("%3d/%3d ", channel.serverID,
  2056. d195 1
  2057. a195 1
  2058.     PrintCommand(io_StdOut, channel.requestRpcHdr.command, " %-10s ");
  2059. d197 1
  2060. a197 1
  2061.         Io_Print(" free");
  2062. d200 1
  2063. a200 1
  2064.         Io_Print(" busy");
  2065. d203 1
  2066. a203 1
  2067.         Io_Print(" wait");
  2068. d206 1
  2069. a206 1
  2070.         Io_Print(" input");
  2071. d209 1
  2072. a209 1
  2073.         Io_Print(" timeout");
  2074. d211 1
  2075. a211 1
  2076.     Io_Print("\n");
  2077. d221 1
  2078. a221 1
  2079.     Io_Print("%2s %7s %-8s state\n", "I", "Client", "RPC");
  2080. d227 3
  2081. a229 3
  2082.     Io_Print("%2d ", index);
  2083.     Io_Print("%3d/%3d ", server.clientID, server.channel);
  2084.     PrintCommand(io_StdOut, server.requestRpcHdr.command, " %-10s ");
  2085. d231 1
  2086. a231 1
  2087.         Io_Print("not ready");
  2088. d234 1
  2089. a234 1
  2090.         Io_Print("free ");
  2091. d237 1
  2092. a237 1
  2093.         Io_Print("busy ");
  2094. d240 1
  2095. a240 1
  2096.         Io_Print("wait ");
  2097. d243 1
  2098. a243 1
  2099.         Io_Print("age %d ", server.age);
  2100. d246 1
  2101. a246 1
  2102.         Io_Print("frag ");
  2103. d249 1
  2104. a249 1
  2105.         Io_Print("no reply ");
  2106. d251 1
  2107. a251 1
  2108.     Io_Print("\n");
  2109. d262 7
  2110. a268 7
  2111.     Io_Print("Sync Statistics\n");
  2112.     Io_Print("numWakeups = %d ", syncStat.numWakeups);
  2113.     Io_Print("numWakeupCalls = %d ", syncStat.numWakeupCalls);
  2114.     Io_Print("numSpuriousWakeups = %d ", syncStat.numSpuriousWakeups);
  2115.     Io_Print("numLocks = %d ", syncStat.numLocks);
  2116.     Io_Print("numUnlocks = %d ", syncStat.numUnlocks);
  2117.     Io_Print("\n");
  2118. d280 5
  2119. a284 5
  2120.     Io_Print("Sched Statistics\n");
  2121.     Io_Print("numContextSwitches = %d\n", schedStat.numContextSwitches);
  2122.     Io_Print("numFullSwitches    = %d\n", schedStat.numFullCS);
  2123.     Io_Print("numInvoluntary     = %d\n", schedStat.numInvoluntarySwitches);
  2124.     Io_Print("Idle Time          = %d.%06d seconds\n",
  2125. d295 18
  2126. a312 18
  2127.     Io_Print("VM Statistics\n");
  2128.     Io_Print("totalFaults      = %d\n", vmStat.totalFaults);
  2129.     Io_Print("totalUserFaults  = %d\n", vmStat.totalUserFaults);
  2130.     Io_Print("zeroFilled       = %d\n", vmStat.zeroFilled);
  2131.     Io_Print("fsFilled         = %d\n", vmStat.fsFilled);
  2132.     Io_Print("psFilled         = %d\n", vmStat.psFilled);
  2133.     Io_Print("collFaults       = %d\n", vmStat.collFaults);
  2134.     Io_Print("quickFaults      = %d\n", vmStat.quickFaults);
  2135.     Io_Print("code faults      = %d\n", vmStat.codeFaults);
  2136.     Io_Print("heap faults      = %d\n", vmStat.heapFaults);
  2137.     Io_Print("stack faults     = %d\n", vmStat.stackFaults);
  2138.     Io_Print("pagesWritten     = %d\n", vmStat.pagesWritten);
  2139.     Io_Print("cleanWait        = %d\n", vmStat.cleanWait);
  2140.     Io_Print("pageoutWakeup    = %d\n", vmStat.pageoutWakeup);
  2141.     Io_Print("pageoutNoWork    = %d\n", vmStat.pageoutNoWork);
  2142.     Io_Print("pageoutWait      = %d\n", vmStat.pageoutWait);
  2143.     Io_Print("mapPageWait      = %d\n", vmStat.mapPageWait);
  2144.     Io_Print("accessWait       = %d\n", vmStat.accessWait);
  2145. d325 1
  2146. a325 1
  2147.     Io_Stream output;        /* Output stream */
  2148. d333 1
  2149. a333 1
  2150.     if (String_Compare("on", argv[1]) == 0) {
  2151. d336 1
  2152. a336 1
  2153.     } else if (String_Compare("off", argv[1]) == 0) {
  2154. d344 2
  2155. a345 2
  2156.         output = Io_Open(argv[1], "w");
  2157.         if (output == (Io_Stream)NULL) {
  2158. d351 1
  2159. a351 1
  2160.     output = io_StdOut;
  2161. d358 1
  2162. a358 1
  2163.     buffer = (Address)Mem_Alloc(bufSize);
  2164. d364 1
  2165. a364 1
  2166.     Io_PrintStream(output, "\n");
  2167. d366 1
  2168. a366 1
  2169.     Io_PrintStream(output, \
  2170. d380 1
  2171. a380 1
  2172.     Io_PrintStream(output, "%8x", rpcHdrPtr->ID);
  2173. d384 1
  2174. a384 1
  2175.     Io_PrintStream(output, " %3d.%04d",
  2176. d390 1
  2177. a390 1
  2178.         Io_PrintStream(output, " %8x", rpcHdrPtr->command);
  2179. d394 1
  2180. a394 1
  2181.     Io_PrintStream(output, " %4d %d %4d %d",
  2182. d399 1
  2183. a399 1
  2184.     Io_PrintStream(output, " %5d %5d %5d %2d %5x",
  2185. d405 1
  2186. a405 1
  2187.     Io_PrintStream(output, "\n");
  2188. d416 1
  2189. a416 1
  2190.     Io_Stream stream;
  2191. d467 1
  2192. a467 1
  2193.     Io_PrintStream(stream, format, string);
  2194. d476 1
  2195. a476 1
  2196.     Io_Stream stream;
  2197. d480 1
  2198. a480 1
  2199.     char buffer[CVT_INT_BUF_SIZE];
  2200. d602 1
  2201. a602 3
  2202.         int len;
  2203.  
  2204.         len = Cvt_ItoA(command, 10, buffer);
  2205. d607 1
  2206. a607 1
  2207.     Io_PrintStream(stream, format, string);
  2208. d616 1
  2209. a616 1
  2210.     Io_Stream stream;
  2211. d636 1
  2212. a636 1
  2213.         Io_PrintString(buffer, "Ci %c ", type - RPC_CLIENT_a + 'a');
  2214. d645 1
  2215. a645 1
  2216.         Io_PrintString(buffer, "Cp %c ", type - RPC_CLIENT_A + 'A');
  2217. d654 1
  2218. a654 1
  2219.         Io_PrintString(buffer, "Ci %c ", type - RPC_SERVER_a + 'a');
  2220. d663 1
  2221. a663 1
  2222.         Io_PrintString(buffer, "Cp %c ", type - RPC_SERVER_A + 'A');
  2223. d673 1
  2224. a673 1
  2225.         (void)Cvt_ItoA(type, 10, buffer);
  2226. d676 1
  2227. a676 1
  2228.     Io_PrintStream(stream, format, string);
  2229. @
  2230.  
  2231.  
  2232. 1.7
  2233. log
  2234. @*** empty log message ***
  2235. @
  2236. text
  2237. @d11 1
  2238. a11 1
  2239. static char rcsid[] = "$Header: rpcStat.c,v 1.6 87/09/29 21:55:21 brent Exp $ SPRITE (Berkeley)";
  2240. d199 1
  2241. a199 1
  2242.     PrintCommand(io_StdOut, channel.requestRpcHdr.command, " %-8s ");
  2243. d233 1
  2244. a233 1
  2245.     PrintCommand(io_StdOut, server.requestRpcHdr.command, " %-8s ");
  2246. d396 1
  2247. a396 1
  2248.         PrintCommand(output, rpcHdrPtr->command, " %-8s");
  2249. d489 1
  2250. a489 1
  2251.         string = "echo";
  2252. d492 1
  2253. a492 1
  2254.         string = "echo2";
  2255. d494 2
  2256. a495 2
  2257.     case RPC_FS_SPRITE_OPEN:
  2258.         string = "open";
  2259. d497 2
  2260. a498 2
  2261.     case RPC_FS_NAME:
  2262.         string = "name";
  2263. d500 2
  2264. a501 2
  2265.     case RPC_FS_LOCATE:
  2266.         string = "(locate)";
  2267. a511 9
  2268.     case RPC_FS_TRUNC:
  2269.         string = "(trunc)";
  2270.         break;
  2271.     case RPC_FS_APPEND:
  2272.         string = "append";
  2273.         break;
  2274.     case RPC_FS_STAT:
  2275.         string = "(stat)";
  2276.         break;
  2277. d513 1
  2278. a513 1
  2279.         string = "unlink";
  2280. a523 6
  2281.     case RPC_FS_CHMOD:
  2282.         string = "(chmod)";
  2283.         break;
  2284.     case RPC_FS_CHOWN:
  2285.         string = "(chown)";
  2286.         break;
  2287. a526 9
  2288.     case RPC_FS_UNIX_PREFIX:
  2289.         string = "unix prefix";
  2290.         break;
  2291.     case RPC_FS_PULLIN:
  2292.         string = "(pullin)";
  2293.         break;
  2294.     case RPC_FS_UPDAT:
  2295.         string = "(update)";
  2296.         break;
  2297. d530 2
  2298. a531 2
  2299.     case RPC_FS_UNIX_OPEN:
  2300.         string = "unix open";
  2301. d533 2
  2302. a534 2
  2303.     case RPC_SEND:
  2304.         string = "send";
  2305. d536 2
  2306. a537 2
  2307.     case RPC_FS_SPRITE_PREFIX:
  2308.         string = "prefix";
  2309. d539 1
  2310. a539 1
  2311.     case RPC_FS_GET_ATTR:
  2312. d542 1
  2313. a542 1
  2314.     case RPC_FS_SET_ATTR:
  2315. d545 6
  2316. d558 1
  2317. a558 1
  2318.         string = "r call";
  2319. d560 2
  2320. a561 2
  2321.     case RPC_FS_START_MIGRATION:
  2322.         string = "start fs xfer";
  2323. a562 6
  2324.     case RPC_FS_FINISH_MIGRATION:
  2325.         string = "end fs xfer";
  2326.         break;
  2327.     case RPC_FS_REMOTE_WAKEUP:
  2328.         string = "r wakeup";
  2329.         break;
  2330. a568 3
  2331.     case RPC_SIG_MIG_SEND:
  2332.         string = "sig mig send";
  2333.         break;
  2334. d570 1
  2335. a570 1
  2336.         string = "rmt wakeup";
  2337. d572 2
  2338. a573 2
  2339.     case RPC_FS_LOCK:
  2340.         string = "lock";
  2341. d575 3
  2342. d582 1
  2343. a582 1
  2344.         string = "consist reply";
  2345. d585 1
  2346. a585 1
  2347.         string = "copy block";
  2348. d588 1
  2349. a588 1
  2350.         string = "makedev";
  2351. d590 2
  2352. a591 2
  2353.     case RPC_FS_GET_ATTR_PATH:
  2354.         string = "stat";
  2355. d593 11
  2356. a603 2
  2357.     case RPC_SIG_SEND:
  2358.         string = "sig send";
  2359. @
  2360.  
  2361.  
  2362. 1.6
  2363. log
  2364. @Printed RPC as a string, not its number
  2365. @
  2366. text
  2367. @d11 1
  2368. a11 1
  2369. static char rcsid[] = "$Header: rpcStat.c,v 1.5 87/09/10 17:26:45 brent Exp $ SPRITE (Berkeley)";
  2370. d199 1
  2371. a199 1
  2372.     PrintCommand(io_StdOut, channel.requestRpcHdr.command, " %-8s");
  2373. d233 1
  2374. a233 1
  2375.     PrintCommand(io_StdOut, server.requestRpcHdr.command, " %-8s");
  2376. @
  2377.  
  2378.  
  2379. 1.5
  2380. log
  2381. @Updated for use with Sys_Stats.
  2382. @
  2383. text
  2384. @d11 1
  2385. a11 1
  2386. static char rcsid[] = "$Header: rpcStat.c,v 1.4 87/05/28 11:28:31 nelson Exp $ SPRITE (Berkeley)";
  2387. d190 1
  2388. a190 1
  2389.     Io_Print("%2s %7s %3s state\n", "I", "Server", "RPC");
  2390. d199 1
  2391. a199 1
  2392.     Io_Print("%3d ", channel.requestRpcHdr.command);
  2393. d225 1
  2394. a225 1
  2395.     Io_Print("%2s %7s %3s state\n", "I", "Client", "RPC");
  2396. d233 1
  2397. a233 1
  2398.     Io_Print("%3d ", server.requestRpcHdr.command);
  2399. @
  2400.  
  2401.  
  2402. 1.4
  2403. log
  2404. @Fixed bug in call to Cvt_ItoA.
  2405. @
  2406. text
  2407. @d11 1
  2408. a11 1
  2409. static char rcsid[] = "$Header: rpcStat.c,v 1.3 87/05/01 15:59:55 brent Exp $ SPRITE (Berkeley)";
  2410. d16 1
  2411. a16 1
  2412. #include "rpc.h"
  2413. d24 2
  2414. d31 4
  2415. a34 2
  2416. Boolean doCltStat = FALSE;
  2417. Boolean doSrvStat = FALSE;
  2418. a38 1
  2419. Boolean doPrefixStat = FALSE;
  2420. d42 5
  2421. a46 3
  2422.     {OPT_TRUE, 'c', (Address)&doCltStat, "Print client RPC statistics"},
  2423.     {OPT_TRUE, 's', (Address)&doSrvStat, "Print server RPC statistics"},
  2424.     {OPT_TRUE, 'S', (Address)&doSchedStat, "Print scheduling statistics"},
  2425. a48 1
  2426.     {OPT_TRUE, 'p', (Address)&doPrefixStat, "Print FS prefix table"},
  2427. d69 1
  2428. a69 1
  2429.     if (doCltStat) {
  2430. d72 1
  2431. a72 1
  2432.     if (doSrvStat) {
  2433. d75 6
  2434. a92 3
  2435.     if (doPrefixStat) {
  2436.     PrintPrefixTable();
  2437.     }
  2438. d98 1
  2439. a98 1
  2440.     RpcCltStat rpcCltStat;
  2441. d100 1
  2442. a100 1
  2443.     status = Test_Stats(RPC_CLT_STATS, TRUE, &rpcCltStat);
  2444. d145 1
  2445. a145 1
  2446.     RpcSrvStat rpcSrvStat;
  2447. d147 1
  2448. a147 1
  2449.     status = Test_Stats(RPC_SRV_STATS, TRUE, &rpcSrvStat);
  2450. d184 75
  2451. d262 1
  2452. a262 1
  2453.     status = Test_Stats(SYNC_STATS, 0, &syncStat);
  2454. d280 1
  2455. a280 1
  2456.     status = Test_Stats(SCHED_STATS, 0, &schedStat);
  2457. d295 1
  2458. a295 1
  2459.     status = Test_Stats(VM_STATS, 0, &vmStat);
  2460. a321 8
  2461. PrintPrefixTable()
  2462. {
  2463.     status = Test_Stats(FS_PREFIX_STATS, 0, 0);
  2464.     if (status != SUCCESS) {
  2465.     return;
  2466.     }
  2467. }
  2468.  
  2469. d338 1
  2470. a338 1
  2471.         status = Test_Stats(RPC_TRACE_STATS, RPC_TRACING_ON, 0);
  2472. d341 1
  2473. a341 1
  2474.         status = Test_Stats(RPC_TRACE_STATS, RPC_TRACING_OFF, 0);
  2475. d363 1
  2476. a363 1
  2477.     status = Test_Stats(RPC_TRACE_STATS, bufSize, buffer);
  2478. d371 1
  2479. a371 1
  2480.         "%8s %5s %10s %4s %6s %6s %6s %5s %5s %5s %8s\n", \
  2481. d388 1
  2482. a388 1
  2483.     Io_PrintStream(output, " %3d.%06d",
  2484. d390 1
  2485. a390 1
  2486.                deltaTime.microseconds);
  2487. d393 5
  2488. a397 1
  2489.     PrintCommand(output, rpcHdrPtr->command, " %-8s");
  2490. d501 1
  2491. a501 1
  2492.         string = "locate";
  2493. d513 1
  2494. a513 1
  2495.         string = "trunc";
  2496. d519 1
  2497. a519 1
  2498.         string = "stat";
  2499. d534 1
  2500. a534 1
  2501.         string = "chmod";
  2502. d537 1
  2503. a537 1
  2504.         string = "chown";
  2505. d546 1
  2506. a546 1
  2507.         string = "pullin";
  2508. d549 1
  2509. a549 1
  2510.         string = "update";
  2511. d607 12
  2512. @
  2513.  
  2514.  
  2515. 1.3
  2516. log
  2517. @major clean up
  2518. @
  2519. text
  2520. @d11 1
  2521. a11 1
  2522. static char rcsid[] = "$Header: proto.c,v 1.5 86/09/18 06:35:57 ouster Exp $ SPRITE (Berkeley)";
  2523. d19 1
  2524. d225 3
  2525. a227 1
  2526.     Io_Print("pagesRead        = %d\n", vmStat.pagesRead);
  2527. d406 1
  2528. a406 1
  2529.     char buffer[10];
  2530. @
  2531.  
  2532.  
  2533. 1.2
  2534. log
  2535. @Added strings corresponding to  migration RPC calls.
  2536. @
  2537. text
  2538. @d22 1
  2539. a27 8
  2540. /*
  2541.  * One extra character for a null byte
  2542.  */
  2543.  
  2544. #define BUFSIZE 1025
  2545. int  bufSize = BUFSIZE-1;
  2546. char buffer[BUFSIZE];
  2547.  
  2548. d37 1
  2549. d40 1
  2550. a41 1
  2551.     {OPT_TRUE, 'S', (Address)&doSchedStat, "Print scheduling statistics"},
  2552. a42 1
  2553.     {OPT_TRUE, 't', (Address)&doRpcTrace, "Print trace of RPCs"},
  2554. d54 1
  2555. a84 2
  2556.  
  2557.  
  2558. d254 4
  2559. d283 4
  2560. a286 2
  2561.     status = Test_Stats(RPC_TRACE_STATS, RPC_TRACE_LEN * sizeof(Rpc_Trace),
  2562.                      (Address)rpc_Trace);
  2563. a289 16
  2564.     /*
  2565.      * Spin through and locate the oldest record.
  2566.      */
  2567.     rpcTraceIndex = -1;
  2568.     for (index=0 ; index<RPC_TRACE_LEN ; index++) {
  2569.     rpcHdrPtr = &rpc_Trace[index].rpcHdr;
  2570.     if (rpcHdrPtr->flags & RPC_LAST_REC) {
  2571.         rpcHdrPtr->flags &= ~RPC_LAST_REC;
  2572.         rpcTraceIndex = index;
  2573.         break;
  2574.     }
  2575.     }
  2576.     if (rpcTraceIndex == -1) {
  2577.     Io_PrintStream(io_StdErr, "Didn't find last record mark\n");
  2578.     rpcTraceIndex = 0;
  2579.     }
  2580. d299 5
  2581. d306 1
  2582. a306 15
  2583.     index = rpcTraceIndex;
  2584.     do {
  2585.     /*
  2586.      * This is a delayed clearing of junk rpc headers.
  2587.      */
  2588.     rpcHdrPtr = &rpc_Trace[index].rpcHdr;
  2589.     if (rpcHdrPtr->flags == 0) {
  2590.         Byte_Zero(sizeof(RpcHdr), (Address)rpcHdrPtr);
  2591.     }
  2592.     /*
  2593.      * Can't do comments because they are pointers to strings in
  2594.      * the kernel's address space.
  2595.      */
  2596.     rpc_Trace[index].comment = "";
  2597.  
  2598. d308 1
  2599. a308 1
  2600.     PrintType(output, rpc_Trace[index].type, " %-5s");
  2601. d310 1
  2602. a310 1
  2603.     Time_Subtract(rpc_Trace[index].time, baseTime, &deltaTime);
  2604. d314 1
  2605. a314 1
  2606.     baseTime = rpc_Trace[index].time;
  2607. d329 1
  2608. a329 3
  2609.  
  2610.     index = (index + 1) % RPC_TRACE_LEN;
  2611.     } while (index != rpcTraceIndex);
  2612. d413 1
  2613. a413 1
  2614.     case RPC_FS_OPEN:
  2615. d461 2
  2616. a462 2
  2617.     case RPC_FS_PREFIX:
  2618.         string = "prefix";
  2619. d473 2
  2620. a474 2
  2621.     case RPC_FS_OPEN2:
  2622.         string = "open2";
  2623. d479 2
  2624. a480 2
  2625.     case RPC_FS_PREFIX2:
  2626.         string = "prefix2";
  2627. d511 15
  2628. @
  2629.  
  2630.  
  2631. 1.1
  2632. log
  2633. @Initial revision
  2634. @
  2635. text
  2636. @d1 14
  2637. d65 1
  2638. a65 4
  2639.     int status;
  2640.     int openFileId;
  2641.     char c;
  2642.     char *fileName;
  2643. d92 1
  2644. d526 5
  2645. a530 2
  2646.     case RPC_FS_TRANSFER_HANDLE:
  2647.         string = "transfer";
  2648. @
  2649.